//
//  HYDiscripitonTableViewCell.m
//  MusicMV
//
//  Created by Eternity on 16/3/19.
//  Copyright © 2016年 Eternity. All rights reserved.
//

#import "HYDiscripitonTableViewCell.h"

@interface HYDiscripitonTableViewCell ()

@end



@implementation HYDiscripitonTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    return self;
}

- (void)create {
    UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(self.contentView.frame.size.width , 15 * ht, 30 * wt, 30 * ht)];
    image.image = [UIImage imageNamed:@"inDetail"];
    [self.contentView addSubview:image];
    self.totalLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_totalLabel];
    self.headerImage = [[UIImageView alloc] init];
    [self.contentView addSubview:_headerImage];
    self.artistNameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_artistNameLabel];
    self.regdateLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_regdateLabel];
    self.DescriptionLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_DescriptionLabel];

}

- (void)layoutSubviews {
//     [_headerImage mas_makeConstraints:^(MASConstraintMaker *make) {
//         make.left.offset(10 * wt);
//         make.top.offset(5 * ht);
//         make.width.mas_equalTo(50 * wt);
//         make.height.mas_equalTo(50 * ht);
//     }];
    _headerImage.frame = CGRectMake(10 * wt, 5 * ht, 50 * wt, 50 * ht);

    _headerImage.backgroundColor = [UIColor clearColor];
    _headerImage.layer.cornerRadius = 25;
//    [_artistNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.offset(65 * wt);
//        make.top.offset(20 * ht);
//        make.width.mas_equalTo(SCREEN_WIDTH / 2);
//        make.height.mas_equalTo(20 * ht);
//    }];
    _artistNameLabel.frame = CGRectMake(65 * wt, 20 * ht, SCREEN_WIDTH / 2, 20 * ht);

    _artistNameLabel.backgroundColor = [UIColor clearColor];
    _artistNameLabel.textColor = RGBA(0, 220, 190, 1);
    _artistNameLabel.font = [UIFont systemFontOfSize:14];
//[_totalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//    make.left.offset(10 * wt);
//    make.top.offset(60 * ht);
//    make.width.mas_equalTo(SCREEN_WIDTH);
//    make.height.mas_equalTo(20 * ht);
//}];
    _totalLabel.frame = CGRectMake(10 * wt, 60 * ht, SCREEN_WIDTH, 20 * ht);

    _totalLabel.font = [UIFont systemFontOfSize:14];

    _totalLabel.textColor = [UIColor whiteColor];
    
    _totalLabel.backgroundColor = [UIColor clearColor];
//    [_regdateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.offset(10 * wt);
//        make.top.offset(85 * ht);
//        make.width.mas_equalTo(SCREEN_WIDTH);
//        make.height.mas_equalTo(20 * ht);
//    }];
    _regdateLabel.frame = CGRectMake(10 * wt, 85 * ht, SCREEN_WIDTH, 20 * ht);

    _regdateLabel.textColor = [UIColor cyanColor];
    _regdateLabel.backgroundColor = [UIColor clearColor];
    _regdateLabel.font = [UIFont systemFontOfSize:14];

    CGSize size =  [XRAFNetworkTool labelRectWithSize:CGSizeMake(SCREEN_WIDTH - 20 * wt, 0) LabelText:_model.Description Font:[UIFont systemFontOfSize:17]];
    
    _DescriptionLabel.frame = CGRectMake(10 *wt, 110 * ht, SCREEN_WIDTH - 20 * wt, size.height);
    
    
    _DescriptionLabel.numberOfLines = 0;
}

- (void)setModel:(HYVideoPlayerModel *)model {
    
    _model = model;
    
    [_headerImage sd_setImageWithURL:[NSURL URLWithString:_model.artistAvatar]];
    _artistNameLabel.text = [NSString stringWithFormat:@"艺人: %@",_model.artistName];
    _regdateLabel.text = [NSString stringWithFormat:@"发布时间: %@",_model.regdate];
    _DescriptionLabel.text = _model.Description;
    
    _DescriptionLabel.textColor = [UIColor whiteColor];
    _DescriptionLabel.backgroundColor = [UIColor clearColor];

}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
